package day1.udp.dictionary_service;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

public class Log {
    public static void println(Object o) {
        Date date = new Date();
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        String now = format.format(date);

        System.out.println(now + ": " + o.toString());
    }

    public static void print(Object o) {
        Date date = new Date();
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        String now = format.format(date);

        System.out.print(now + ": " + o.toString());
    }

    public static void printf(String fmt, Object... args) {
        Date date = new Date();
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
        String now = format.format(date);

        System.out.printf(now + ": " + fmt, args);
    }

    public static void main(String[] args) {
        print("Hello\r\n");
        println("你好");
        printf("%s %d", "Go", 13);
    }
}
